package com.example.cloudpracticeplatform.mapper;

import com.example.cloudpracticeplatform.entity.Teacher;
import org.apache.ibatis.annotations.*;

@Mapper
public interface TeacherMapper {
    @Insert("INSERT INTO teachers(username, password, email) VALUES(#{username}, #{password}, #{email})")
    @Options(useGeneratedKeys = true, keyProperty = "teacherId")
    int insert(Teacher teacher);

    @Select("SELECT teacher_id, username, password, email FROM teachers WHERE username = #{username}")
    Teacher findByUsername(String username);

    @Select("SELECT teacher_id, username, password, email FROM teachers WHERE teacher_id=#{teacherId}")
    Teacher findById(Integer teacherId);
}